package only.level5.railgun.ysartifactsimulation.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import only.level5.railgun.ysartifactsimulation.utils.ArtifactUtils;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/artifact_info")
public class ArtifactController {
    private static final ObjectMapper mapper = new ObjectMapper();

    @PostMapping(value = "/{slot}")
    @ResponseBody
    public String getArtifactInfo(@PathVariable int slot) throws JsonProcessingException {
        List<double[]> temp = switch (slot) {
            case 0 -> ArtifactUtils.FLOWER_LIST;
            case 1 -> ArtifactUtils.PLUME_LIST;
            case 2 -> ArtifactUtils.EON_LIST;
            case 3 -> ArtifactUtils.GOBLET_LIST;
            case 4 -> ArtifactUtils.CIRCLET_LIST;
            default -> null;
        };

        return mapper.writeValueAsString(temp);
    }
}
